<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="/WEB-INF/tld/core.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/tld/orderStatus.tld" prefix="os" %>
<%@ taglib uri="/WEB-INF/tld/fun.tld" prefix="fn"%>
<html>

<%@ include file="../common.jsp"%>
<script type="text/javascript"
	src="<%=basePath%>js/datePicker/WdatePicker.js" defer="defer"></script>
<script type="text/javascript"
	src="js/artDialog/artDialog.source.js?skin=idialog"></script>
<script type="text/javascript" src="js/page.js"></script>
<script type="text/javascript" src="js/dialogBase.js"></script>
<script type="text/javascript" defer="defer">
	TkCommit = function(cid) {
		$.ajax({
			url : 'ticketAction_ticketNotice.shtml?',
			type : "post",
			data : {
				'cid' : cid
			},
			cache : false,
			success : function(data) {
				location.reload();
			}
		});
	};

	check = function(id,start,flightNo) {
		if ($.trim(start) == null || $.trim(start) == '') {
			alert('请选择航变的时间！');
			return false;
		} else if ($.trim(flightNo) == null || $.trim(flightNo) == '') {
			alert('请输入航班号');
			return false;
		}else{
		return true;
		}
	};

	Notice = function(id) {
		art.dialog({
					padding : 0,
					id : 'nt_' + id,
					title : '添加航变通知',
					content : '<lable>航变时间：</lable><input id=\"start\" style="width: 120px;" readonly=\"readonly\" class=\"Wdate\"  name=\"childrenOrder.depTime\" type=\"text\" onclick=\"WdatePicker({dateFmt:\'yyyy-MM-dd HH:mm\',minDate:\'%y-%M-%d %H:%m\'})\" /><br/><lable>航班号：</lable><input name=\"childrenOrder.flightNo\" id=\"flightNo\"> ',
					width : '20em',
					lock : true,
					ok : function() {		
					
					var start = $("#start").val();
					var flightNo = $("#flightNo").val();
					if(check(id,start,flightNo)==true){
						$.ajax({
							url : 'smsNotice_FlightChangeNotice.shtml',
							type : "post",
							data : {
								'id' : id, 'start' : start, 'flightNo' : flightNo
							},
							cache : false,						
							loading : this.content('航变正在处理中，请等待……'),
								success : function(data) {
									var result = '';
									if (data == 'success') {
										result = '航变提交成功';
									} else {
										result = data;
									}
									closeAllDialog();
									art.dialog({
											lock: true,
											title : '系统提示',
											content : ''
													+ result
													+ '，2秒后关闭……',
											time : 2,
											close : function() {
												location.href="plane/flightChange_getList.shtml";
											}
										});
								}
						});	
						}
					    return false;
					},
					cancelVal : '取消',
					cancel : true
				});
		
		
	};
</script>

<body>
	<form action="plane/flightChange_getList.shtml" method="post">
			<table width="100%" border="0" cellpadding="0" cellspacing="0" id="myTable">
		<tr>
			<td width="17" valign="top" background="images/mail_leftbg.gif"><img
				src="images/left-top-right.gif" width="17" height="29" /></td>
			<td valign="top" background="images/content-bg.gif">
			<div class="titlebt">航班查询</div>
			</td>
			<td width="16" valign="top" background="images/mail_rightbg.gif"><img
				src="images/nav-right-bg.gif" width="16" height="29" /></td>
		</tr>
		<tr>
			<td valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
			<td valign="top" bgcolor="#F7F8F9">
			<br/>
				<table border="0" cellpadding="0" cellspacing="0" width="100%" class="mytable">
						<tr><th class="left" width="15%">选择条件</th><td class="border-top">
								<input type="radio" name="childOrder.title" ${(childOrder.title==1 || childOrder.title==null)? 'checked':''} value="1" id="fc_flight" />
								<label for="fc_flight">航班号</label> 
								<input type="radio" name="childOrder.title" value="2" ${childOrder.title==2? 'checked':''} id="fc_pnr" />
								<label for="fc_pnr">PNR编码</label>
							</td></tr>
						<tr><th class="left" width="15%">输入条件</th>
						<td><input name="childOrder.decription" value="${childOrder.decription}"></td>
						</tr>
						<tr>
							<th class="left" width="15%">航班日期</th>
							<td><input class="Wdate"
								onclick="WdatePicker({minDate:'%y-%M-%d'})"
								name="childOrder.startTime" value="${childOrder.startTime}"
								readonly="readonly" /> ~ <input class="Wdate"
								name="childOrder.endTime" value="${childOrder.endTime}"
								readonly="readonly" onclick="WdatePicker({minDate:'%y-%M-%d'})" />
							</td>
						</tr>
						<tr>
							<td style="text-align: center;" class="left" colspan="3"><button id="btn_search" type="submit" class="Submit">立即查询</button>&nbsp;&nbsp;<button id="btn_clear" type="button" onclick="clearAll(this.form)" class="Submit">清 空</button></td>
						</tr>
					</table></td>
				<td background="images/mail_rightbg.gif">&nbsp;</td>
			</tr>
			<tr>
				<td valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
				<td valign="top" bgcolor="#F7F8F9">
					<TABLE height="auto" border=0 class="mytable" cellPadding=0 cellSpacing=0>
						<TBODY>
							<TR>
								<TD height="5" colspan="16"></TD>
							</TR>
							<TR>
								<TH class="left">航班日期</TH>
								<TH>起飞时间</TH>
								<TH>航班号</TH>
								<TH>舱位</TH>
								<TH>订单状态</TH>
								<TH>操作</TH>
							</TR>
							<s:if test="#request.orders!=null && #request.orders.size()>0">
								<s:iterator value="#request.orders" var="order">
									<tr>
										<td class="left"><s:date name="sdate"
												format="yyyy年MM月dd日" />
										</td>
										<td><s:date name="depTime" format="HH:mm" />
										</td>
										<td><s:property value="#order.flightNo" />
										</td>
										<td><s:property value="#order.cabinCode" />
										</td>
										<td><os:apiJrOrder
												status="${order.orderStatus!=null?order.orderStatus:'-99'}" />
										</td>
										<td>	<button class="Submit"
													onclick="Notice('${order.id}');return false">航变通知</button><s:if test="orderStatus==2">
												<button class="Submit"
													onclick="TkCommit('${order.id}');return false;">短信通知</button>
												<button class="Submit"
													onclick="Notice('${order.id}');return false">航变通知</button>
											</s:if> <s:else>
							        					未出票
							        				</s:else></td>
									</tr>
								</s:iterator>
								<tr>
									<td class="left"  colspan="6"  align="right"
										style="background: #FAFBFC repeat-x; height: 28">
										${vo.pageBean.pageToolsMenu}</td>
								</tr>
							</s:if>
							<s:else>
								<tr>
									<td class="left" colspan="6" align="center"
										style="background: #FAFBFC repeat-x; height: 28">
										未搜索到符合条件的信息……</td>
								</tr>
							</s:else>
						</TBODY>
					</TABLE>
						</td>
			<td background="images/mail_rightbg.gif">&nbsp;</td>
		</tr>
		
		<tr>
			<td valign="bottom" background="images/mail_leftbg.gif"><img
				src="images/buttom_left2.gif" width="17" height="17" /></td>
			<td background="images/buttom_bgs.gif"><img
				src="images/buttom_bgs.gif" width="17" height="17"></td>
			<td valign="bottom" background="images/mail_rightbg.gif"><img
				src="images/buttom_right2.gif" width="16" height="17" /></td>
		</tr>
		</table>
	</form>
</body>
</html>